package com.kaisu.blog.application.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author kaisu
 */
@Data
@Component
@ConfigurationProperties(prefix = "blog.security")
public class AuthProperties {
    private String key;

    private JWT jwt;

    private String prefix;

    private List<String> permitStatic;

    private List<String> permitMethod;

    @Data
    public static class JWT {

        private Claims claims = new Claims();
        private String authHeader;
        private String secret;
        private Type type = Type.RANDOM;

        public enum Type {
            RANDOM, FOREVER
        }

        @Data
        public static class Claims {
            private String issuer = "AppName";
            private String audience = "Web";
            private String subject = "Auth";
            private Long expirationTimeMinutes = 60L;
        }
    }
}